package cn.pcManage.goodsManage.controller;

import cn.common.common.model.ServerResponse;
import cn.common.goods.model.BaseGoodsType;
import cn.pcManage.goodsManage.service.IGoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Zhang on 2019/1/11.
 */
@RestController
@RequestMapping("/goodsType")
public class GoodsTypeController {
    @Autowired
    IGoodsTypeService iGoodsTypeService;

    @PostMapping(value = "/addType")
    public ServerResponse<?> addType(@RequestBody BaseGoodsType goodsType){
        return iGoodsTypeService.addType(goodsType);
    }

    @PostMapping(value = "/updateType")
    public ServerResponse<?> updateType(@RequestBody BaseGoodsType goodsType){
        return iGoodsTypeService.updateType(goodsType);
    }

    @PostMapping(value = "/getTypeList")
    public ServerResponse<?> getTypeList(@RequestBody BaseGoodsType goodsType){
        return iGoodsTypeService.getTypeList(goodsType);
    }

    @GetMapping(value = "/getTypeSelect")
    public ServerResponse<?> getTypeSelect(){
        return iGoodsTypeService.getTypeSelect();
    }

    @GetMapping(value = "/backToFatherList")
    public ServerResponse<?> backToFatherList(@RequestParam("id") Integer id){
        return iGoodsTypeService.backToFatherList(id);
    }

    @GetMapping(value = "/deleteType")
    public ServerResponse<?> deleteType(@RequestParam("id") Integer id){
        return iGoodsTypeService.deleteType(id);
    }
}
